/*
 * @Author: your name
 * @Date: 2020-11-06 16:06:24
 * @LastEditTime: 2020-12-09 18:26:14
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \vue-element-admine:\hjimi\人脸\html\face-recognition\src\api\witnessThan.js
 * 
 */
import request from '@/utils/request'

let apis = 'apis/api/algo/library/' 

// ----------------------------------------------脸库/人脸列表操作----------------------------------
/**
 * @description: 创建脸库
 * @param {code,description,displayName,maxSize} 
 */
export function library(params) {
    return request({
      url: apis,
      method: 'post',
      data: params,
      headers: {"Content-Type": "application/json"}
    })
  }

  /**
 * @description: 查询目标库
 * @param {imageId,libraryCode} 
 */
export function queryLibrary(params) {
  return request({
    url: apis,
    method: 'GET',
    params
  })
}
  /**
 * @description: 查询最大的图片数量
 * @param {imageId,libraryCode} 
 */
export function queryMaxCount(params) {
  return request({
    url: `${ apis }maxcount`,
    method: 'GET',
    params
  })
}

  /**
 * @description: 查询脸库图片
 * @param {size,current,libraryCode(脸库编码),milvusRecordIds,imageIds,imageTypes,storageType,createTimeFrom,createTimeTo} 
 */
export function getLibraryimage(params) {
  return request({
    url: 'apis/api/algo/libraryimage',
    method: 'get',
    params
  })
}

  /**
 * @description: 删除/清空目标库
 * @param {code,flagDrop} 
 */
export function deleteLibrary(params, code) {
  return request({
    url: `${ apis }${ code }`,
    method: 'DELETE',
    params
  })
}

  /**
 * @description: 获取单张人脸图片
 * @param {imageId,libraryCode} 
 */
export function getFaceImage(params) {
  return request({
    url: `${ apis }face`,
    method: 'get',
    params
  })
}

  /**
 * @description: 删除单张人脸图片
 * @param {imageId,libraryCode} 
 */
export function deleteFaceImage(params) {
  return request({
    url: `${ apis }face`,
    method: 'DELETE',
    params
  })
}

// -----------------------------------------------人脸上传---------------------------------------------
  /**
 * @description: 人脸上传
 * @param {code,showFeature,files,format,width,height} 
 */
export function faceUpload(params) {
  return request({
    url: `${ apis }import/face`,
    // url: 'apis/algo/library/queryMaxCount',
    method: 'post',
    data: params
  })
}


// -----------------------------------------------人脸属性---------------------------------------------
export function attribute(params) {
  return request({
    url: `apis/api/algo/face/attribute`,
    method: 'post',
    params
  })
}
 